using UnityEngine;
using UnityEngine.UI;

public class TextFade : BaseMeshEffect
{
    [Lablel("上边颜色")]
    public Color UpColor = Color.black;

    [Lablel("下边颜色")]
    public Color BottomColor = Color.black;

    public override void ModifyMesh(VertexHelper vh)
    {
        if (!IsActive())
            return;

        int count = vh.currentVertCount;

        int verValue;
        UIVertex vertex = new UIVertex();
        for (int i = 0; i < count; i++)
        {
            verValue = i % 4;
            vh.PopulateUIVertex(ref vertex, i);
            if (verValue < 2)
            {
                vertex.color = UpColor;
            }
            else
            {
                vertex.color = BottomColor;
            }
            vh.SetUIVertex(vertex, i);
        }
    }
}
